// src/store/index.js 完整代码

import Vue from 'vue'
import Vuex from 'vuex'
import mutations from './mutations'
import actions from './actions'

Vue.use(Vuex);

const state = {
	global:{
		isLogin:false,//是否登陆
		version:'0.0.9',//当前版本
		lang:localStorage.lang?localStorage.lang:'zh_CN',//国际化语言
		loadBmap:false//百度地图是否加载
	},//全局属性
	map:{
        type:'gaode',
    		mode:0,//模式 0默认全局展示 1跟踪模式  2轨迹回放模式
    		center:[117.284073, 31.75012],
        zoom:12,
    		isTrackCenter:true,//画面是否跟随
    	},
	user:{},//用户信息
	permissions:{//用户权限
			user:{roleKeys:''}
	},
	devices:{//设备列表
			selectId:0,//选中的设备ID
			index:{},//索引
			list:[]//设备数组
	},
	bubble:{ //气泡内容
                coord:[117.284073, 31.75012],
                content:'Demo',
                hide:true,
                circle:{
                  visible:false,
                  radius:2000,
                  strokeColor:'#409EFF',
                  fillColor:'rgba(64,158,255, 0.2)'
                }
    		  },
	popup:{
		header:"",
		topRight:'GPS',
    coord:[116.404, 39.915],
    content:[],
		footer:"",
		visible:false,
		circle:{
			visible:false,
			radius:2000,
			strokeColor:'#409EFF',
			fillColor:'rgba(64,158,255, 0.2)'
		}
	},
	events:{ //未读事件条数
		unReadCount:0
	},
	onlineState:{ //设备在线 离线 激活状态
			 online:1,
			 offline:0,
			 notactive:0
	},
	status:{'-1':'offline',0:'offline',1:'online',2:'fenceEnter',3:'fenceExit',4:'overSpeed',9:'alarm',10:'拆除报警',11:'静默报警',12:'低电报警'},//事件状态字典
	roleKeys:{'personal':'personal','enterprise':'enterprise','administrators':'administrators','root':'root'},//事件状态字典
	deviceStates:{'stop':'停','clockwise':'顺','inverse':'反'},//设备运转状态
	alarms:{'sos':'求救报警','idle':'静默报警','vibration':'vibration','powerOff':'powerOff','powerCut':'powerOff','lowBattery':'低电报警','removing':'拆除报警'},//报警字典
	dict:{
    		commandViews:{},//命令格式视图数据
    		commandIdsByType:{},//设备类型对应的命令
    		deviceTypes:[],//设备类型字典
    	},
};

export default new Vuex.Store({
	state,
	mutations,
	actions
})
